package com.example;

import javax.microedition.khronos.opengles.GL10;

import com.step.Step;
import com.step.Step.Dimension;
import com.step.graphic.Texture;
import com.step.graphic.TextureRegion;
import com.step.sprite.Sprite2D;

public class TextureRegionExample extends BaseExample{
	Sprite2D sprite2d;
	TextureRegion region1;
	TextureRegion region2;
	@Override
	public void create() {
		Texture texture = new Texture("textures/logo.png");
		region1 = new TextureRegion(texture, 256, 256);
		region2 = new TextureRegion(new Texture("textures/wood.jpg"));
		sprite2d = new Sprite2D(region1);
		Step.dimension = Dimension.d2d;
	}
	
	int deltatime = 0;
	@Override
	public void update() {			
		deltatime++;
		/*
		if(deltatime % 100 > 50){
			sprite2d.setRegion(region2);
		}
		else{
			sprite2d.setRegion(region1);
		}*/
		sprite2d.setTexture(region2.getTexture());
		GL10 gl = Step.gl;
		
		gl.glClearColor(1, 1, 1, 1);
		sprite2d.rotate(5);
		sprite2d.draw(gl);
	}	
}
